import request from '@/utils/http'

/**
 * 库存详情API服务
 * 参照原项目：RuoYi-WMS-VUE/src/api/wms/inventoryDetail.js
 */
export class WmsInventoryDetailService {
  /**
   * 分页查询库存详情列表
   */
  static async list(query: Record<string, any> = {}) {
    return request.get({
      url: '/wms/inventoryDetail/list',
      params: query
    })
  }

  /**
   * 查询库存详情列表（无分页）
   */
  static async listNoPage(query: Record<string, any> = {}) {
    return request.get({
      url: '/wms/inventoryDetail/listNoPage',
      params: query
    })
  }

  /**
   * 查询库存详情详细
   */
  static async detail(id: string | number) {
    return request.get({
      url: `/wms/inventoryDetail/${id}`
    })
  }

  /**
   * 新增库存详情
   */
  static async create(data: Record<string, any>) {
    return request.post({
      url: '/wms/inventoryDetail',
      data
    })
  }

  /**
   * 修改库存详情
   */
  static async update(data: Record<string, any>) {
    return request.put({
      url: '/wms/inventoryDetail',
      data
    })
  }

  /**
   * 删除库存详情
   */
  static async delete(id: string | number | Array<string | number>) {
    const ids = Array.isArray(id) ? id.join(',') : id
    return request.del({
      url: `/wms/inventoryDetail/${ids}`
    })
  }

  /**
   * 导出库存详情
   */
  static async export(query: Record<string, any> = {}) {
    return request.post({
      url: '/wms/inventoryDetail/export',
      data: query,
      responseType: 'blob'
    })
  }
}

// 为了兼容动态API系统，导出配置对象
export const inventoryDetailApiConfig = {
  list: '/wms/inventoryDetail/list',
  listNoPage: '/wms/inventoryDetail/listNoPage',
  detail: '/wms/inventoryDetail',
  create: '/wms/inventoryDetail',
  update: '/wms/inventoryDetail',
  delete: '/wms/inventoryDetail',
  export: '/wms/inventoryDetail/export'
}

export default WmsInventoryDetailService
